/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.exam.questionOption.service;
 
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.bussiness.exam.questionOption.domain.QuestionOption;
import com.seeyoui.kensite.bussiness.exam.questionOption.persistence.QuestionOptionMapper;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;

/**
 * QuestionOption
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-01-02
 */

@Service
public class QuestionOptionService extends BaseService {
	
	@Autowired
	private QuestionOptionMapper questionOptionMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public QuestionOption findOne(String id) throws CRUDException{
		return questionOptionMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param questionOption
	 * @return
	 * @throws CRUDException
	 */
	public List<QuestionOption> findList(QuestionOption questionOption) throws CRUDException {
		return questionOptionMapper.findList(questionOption);
	}
	
	/**
	 * 查询所有数据集合
	 * @param questionOption
	 * @return
	 * @throws CRUDException
	 */
	public List<QuestionOption> findAll(QuestionOption questionOption) throws CRUDException {
		return questionOptionMapper.findAll(questionOption);
	}
	
	/**
	 * 查询数据总数
	 * @param questionOption
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(QuestionOption questionOption) throws CRUDException {
		return questionOptionMapper.findTotal(questionOption);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param questionOption
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(QuestionOption questionOption) throws CRUDException {
		return questionOptionMapper.findExTotal(questionOption);
	}
	
	/**
	 * 数据新增
	 * @param questionOption
	 * @throws CRUDException
	 */
	public void save(QuestionOption questionOption) throws CRUDException{
		questionOption.preInsert();
		questionOptionMapper.save(questionOption);
	}
	
	/**
	 * 数据修改
	 * @param questionOption
	 * @throws CRUDException
	 */
	public void update(QuestionOption questionOption) throws CRUDException{
		questionOption.preUpdate();
		questionOptionMapper.update(questionOption);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		questionOptionMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param questionOption
	 * @throws CRUDException
	 */
	public void remove(QuestionOption questionOption) throws CRUDException{
		questionOption.preUpdate();
		questionOptionMapper.remove(questionOption);			
	}
	
	/**
	 * 根据试题ID列表查询全部答案选项列表
	 * @param lsQuestionIds
	 * @return
	 * @throws CRUDException
	 */
	public List<QuestionOption> findByQuestionIds(List<String> lsQuestionIds) throws CRUDException {
		return questionOptionMapper.findByQuestionIds(lsQuestionIds);
	}
	
	/**
	 * 根据试题ID查询全部答案选项列表
	 * @param questionId
	 * @return
	 * @throws CRUDException
	 */
	public List<QuestionOption> findByQuestionId(String questionId) throws CRUDException {
		return questionOptionMapper.findByQuestionId(questionId);
	}

}